QuickDraw GX Objects
QuickDraw GX provides many different types of objects: shape objects, style objects, ink objects, transform objects, view device objects, print job objects, printer objects, and so on. This section first describes shape objects, the main type of object used for graphics and typography. Then the section discusses the supporting objects, the objects used by a shape object to modify the drawing and hit-testing processes. Finally, this section discusses the printing objects, the objects used when printing a document.Shape Objects
The shape object represents a single graphics or typographic shape. The shape object has nine properties. Three properties define the shape:
The shape object contains another three properties called the object-related properties:
- the shape type (for example, point, rectangle, text, bitmap, and so on)
- the shape geometry (for example, the coordinates of a point, the coordinates of a rectangle's corners, the characters in a string of text, the pixel image of a bitmap, and so on)
- the shape fill (for example, hollow, solid, inverse, and so on)
Finally, the shape contains three properties that refer to its supporting objects. These properties are:
- the shape attributes, which determine whether the shape object is locked
in memory, whether the shape object can be moved to accelerator card memory, whether the shape's geometry or its transform object is affected
by mapping operations, and so on- the owner count, which reflects how many object references currently refer to the shape object
- the tag list, which points to a list of tag objects--objects you can use to attach application-specific information to your shape object
QuickDraw GX uses the style, ink, and transform objects to modify how the shape object is drawn and how it is hit-tested.
- the style property, which refers to a style object
- the ink property, which refers to an ink object
- the transform property, which refers to a transform object
Figure 1-1 shows a shape object and the three supporting objects it references. The shape object properties shown in italics are references to other objects.
Figure 1-1 The shape object and the objects it references
Graphics Shape Objects
QuickDraw GX provides three types of graphics shapes:
Graphics shapes are represented in memory by shape objects--that is, they have a shape type, a geometry, a shape fill, and they reference style ink and transform objects. They are distinct in these ways:
- geometric shapes, which include points, lines, curves, rectangles, polygons, paths, empty shapes, and full shapes
- bitmap shapes, which encapsulate a pixel image
- picture shapes, which contain a collection of other shapes
Figure 1-2 shows some sample geometric, bitmap, and picture shapes.
- Geometric shapes use their geometry property to hold geometric points, which describe the endpoints and corner points of the shape. Bitmap shapes use their geometry to hold all the information needed to recreate the bitmap, including the color value of each pixel in the bitmap. Picture shapes use their geometry to hold a list of references to other shape objects, even other picture shapes.
- Geometric shapes use the geometric style properties of their style object--for example, properties that control pen width, caps, joins, dashes, and patterns. Bitmap shapes and picture shapes make little use of the information in their style objects.
- Bitmap shapes do not use the color information in their ink objects. Picture shapes use no information from their ink objects.
- QuickDraw GX provides a large number of functions that apply only to geometric shapes, and some functions that apply only to bitmap or picture shapes.
Figure 1-2 Sample graphics shapes
For more information about graphics shapes, see Chapter 3, "Using QuickDraw GX Objects" and the recipes in Chapter 6, "Handling Graphics." For complete reference material, read the Inside Macintosh: QuickDraw GX Graphics book.
Typographic Shape Objects
QuickDraw GX provides three types of typographic shapes:
In many ways, the typographic shapes are similar to the other types of shapes: they have a shape type, a geometry, and a shape fill and they reference a style object, an ink object, and a transform object. They are distinct in three ways:
- text shapes, which represent stylistically simple lines of text
- glyph shapes, which represent lines of text with multiple styles and with individual placements of each character
- layout shapes, which represent typographically sophisticated lines of text
that can include multiple languages, kerning, ligatures, shifting, optical alignment, and hanging punctuation
Figure 1-3 shows some sample text, glyph, and layout shapes.
- Typographic shapes use their geometry properties to store text-related information.
- Typographic shapes use the typographic style properties of their style object--for example, properties that control font, text size, text face, and alignment.
- QuickDraw GX provides a large number of functions that apply only to typographic shapes. In particular, there are a great many functions that allow you to control the appearance of a layout shape.
Figure 1-3 Sample typographic shapes
For more information about typographic shapes, see Chapter 3, "Using QuickDraw GX Objects" and the recipes in Chapter 7, "Handling Typography." For complete reference material, read the Inside Macintosh: QuickDraw GX Typography book.
Supporting Objects
Each shape object references three supporting objects. Each of these supporting objects fulfills a different function:
Figure 1-4 shows some examples of the effects you can produce using
- The properties of the style object describe stylistic variations that affect how the shape is drawn. For different types of shapes, the stylistic variations
are different:
- For geometric shapes, the properties govern such aspects of style as pen width, caps, joins, dashes, and patterns.
- For typographic shapes, the properties govern typographic style characteristics such as font, text face and size, and alignment.
- For layout shapes, the properties govern more sophisticated characteristics such as font features, kerning adjustments, and glyph substitutions.
- The properties of the ink object determine the color and transfer mode of
the shape. The transfer mode describes how a shape interacts with the background over which it is drawn. For example, the default transfer mode specifies that a shape be drawn so as to completely block out whatever it is drawn over. As another example, you might use the transfer mode property to specify that a shape be blended with its background.- The properties of the transform object determine how the shape is clipped, how it is mapped (moved, scaled, skewed, rotated, perspected), how it should be hit-tested, and how the shape is to be rendered. For example, you can specify that a square shape be clipped to a round shape, scaled to half its size, and dithered (or halftoned) to give the illusion of a color that isn't actually available on the output device.
these objects.Figure 1-4 The supporting objects and examples of how they affect shapes
QuickDraw GX provides more types of supporting objects than the three mentioned here. Chapter 3, "Using QuickDraw GX Objects" discusses all the supporting objects in more detail.
Printing Objects
The third important category of objects are the printing objects. These objects represent information about how a document should be printed.There are three main types of printing objects:
There are several other types of printing objects. Chapter 3, "Using QuickDraw GX Objects," discusses all the printing objects in more detail.
- The job object holds printing information for a document. For example, it specifies the number of copies to be printed and the page range to be printed. The job object also contains references to one or more format objects.
- The format object describes how a single document page should be formatted. The job object can have a different format for every page, or multiple pages can share formatting information. Each format object contains a reference to a paper-type object.
- The paper-type object specifies information about the dimensions of the paper onto which a page is printed.